package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.Dao.Impl.CompanyDaoImpl;
import com.ysd.Dao.Impl.NewsClassIficationDaoImpl;
import com.ysd.Dao.Impl.NewsDaoImpl;
import com.ysd.entity.Company;
import com.ysd.entity.News;
import com.ysd.entity.NewsClassiIfication;

public class NewsServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
				//调用指定新闻系列id获取指定系列的新闻
				int cId = Integer.parseInt(request.getParameter("newsClassIficationId"));//接收前台传来的参数
				NewsDaoImpl nDao = new NewsDaoImpl();
				List<News> n = nDao.getNewsList(cId);
				request.setAttribute("n", n);//指定新闻系列的新闻的集合
				NewsClassIficationDaoImpl nicDao = new NewsClassIficationDaoImpl();
				List<NewsClassiIfication> nic = nicDao.grtNewsFenLeiList();
				request.setAttribute("nic", nic);
				request.setAttribute("cId", cId);
		request.getRequestDispatcher("article_list.jsp").forward(request, response);
	
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
